import Vue from 'vue';
import VueRouter from 'vue-router';
import home from '../views/home.vue';

Vue.use(VueRouter);

const routes = [
	{
		path: '/',
		redirect: '/home'
	},
	{
		path: '/home',
		name: 'home',
		component: home,
		redirect: '/home/index',
		children: [
			{
				path: 'index',
				name: 'index',
				component: () => import(/* webpackChunkName: "index" */ '../views/index'),
			},
			{
				path: 'type',
				name: 'type',
				component: () => import(/* webpackChunkName: "type" */ '../views/type/type.vue'),
			},
			{
				path: 'cart',
				name: 'cart',
				component: () => import(/* webpackChunkName: "cart" */ '../views/shopcart/cart.vue'),
			},
			{
				path: 'me',
				name: 'me',
				component: () => import(/* webpackChunkName: "login" */ '../views/me/me.vue'),
			},
		]
	},
	{
		path: '/login',
		name: 'login',
		component: () => import(/* webpackChunkName: "login" */ '../views/login/login.vue'),
	},
	{
		path: '/forGotPass',
		name: 'forGotPass',
		component: () => import(/* webpackChunkName: "forGotPass" */ '../views/login/forGotPass.vue')
	},
	{
		path: '/register',
		name: 'register',
		component: () => import(/* webpackChunkName: "register" */ '../views/login/register.vue')
	}
];

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
});

export default router;
